#include <iostream>
#include <string>
#include <sys/types.h>
#include <unistd.h>

class Channel
{
public:
    Channel()
    {}
    ~Channel()
    {}


private:
    int _wfd;
    std::string _name;
};

void Usage(std::string proc)
{
    std::cout<<"Usage:"<<proc<<" process-num"<<std::endl;
}

//master
int main(int argc,char* argv[])
{
    if(argc!=2)  
    {
        Usage(argv[0]);
        return 1;
    }


    //1、先创建管道
    int num=std::stoi(argv[1]);
    //2、再创建指定个数进程
    for(int i=0;i<num;i++)
    {
        int pipefd[2]={0};
        int n=pipe(pipefd);
        if(n<0)
        {
            return 2;
        }
        pid_t id=fork();
        if(id<0)
        {
            return 3;
        }
    }


    return 0;
}
